| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkAstraeus::ComplexEffectManager Class Referencefinal

Manages the complex effects available in the component. More...

Inheritance diagram for nkAstraeus::ComplexEffectManager:

## Public Member Functions
ComplexEffect * | createOrRetrieve (nkMemory::StringView name, COMPLEX_EFFECT_TYPE type)
ComplexEffect * | record (nkMemory::StringView name, nkMemory::UniquePtr< ComplexEffect > resource)
ComplexEffect * | get (nkMemory::StringView name)
ComplexEffect * | getByIndex (unsigned int id)
void | rename (nkMemory::StringView currentName, nkMemory::StringView newName)
void | erase (nkMemory::StringView name)
nkMemory::UniquePtr< ComplexEffect > | relinquish (nkMemory::StringView name)

## Detailed Description

Manages the complex effects available in the component.

At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.

## Member Function Documentation

## ◆ createOrRetrieve()

ComplexEffect* nkAstraeus::ComplexEffectManager::createOrRetrieve | ( | nkMemory::StringView | name,
|  | COMPLEX_EFFECT_TYPE | type
| ) |  |

Creates if unavailable, or retrieves if available, a complex effect.

Depending on the parameter given for the type, the ComplexEffect instance retrieved will be :

Value | Pointer type
--- | ---
EFFECT_TYPE::BLUR | BlurComplexEffect
EFFECT_TYPE::DOF | DofComplexEffect

To address it fully, casting is required. For instance :

BlurComplexEffect* effect = (BlurComplexEffect*)ComplexEffectManager::getInstance()->createOrRetrieve("effect", COMPLEX_EFFECT_TYPE::BLUR) ;

Parameters

  name | The name of the complex effect to retrieve.
  type | The complex effect type to create.

Returns
  The complex effect requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

## ◆ record()

ComplexEffect* nkAstraeus::ComplexEffectManager::record | ( | nkMemory::StringView | name,
|  | nkMemory::UniquePtr< ComplexEffect > | resource
| ) |  |

Records an already existing resource in the manager, passing its ownership around.

Parameters

  name | The name under which the resource should be recorded.
  resource | The resource to record.

Returns
  A raw pointer over the resource, now recorded in the manager.

## ◆ get()

ComplexEffect* nkAstraeus::ComplexEffectManager::get | ( | nkMemory::StringView | name | ) |

Retrieves a complex effect.

Parameters

  name | The name of the complex effect to retrieve.

Returns
  The complex effect if available, nullptr else.

## ◆ getByIndex()

ComplexEffect* nkAstraeus::ComplexEffectManager::getByIndex | ( | unsigned int | id | ) |

Get a complex effect, by index. Note that one index can map to a different effect after memory is changed. Useful to loop over all available effects in one go.

Parameters

  id | The index of the complex effect to retrieve.

Returns
  The complex effect linked if available, nullptr else.

## ◆ rename()

void nkAstraeus::ComplexEffectManager::rename | ( | nkMemory::StringView | currentName,
|  | nkMemory::StringView | newName
| ) |  |

Renames a complex effect.

Parameters

  currentName | The name of the complex effect to rename.
  newName | The name to reassign to the complex effect.

## ◆ erase()

void nkAstraeus::ComplexEffectManager::erase | ( | nkMemory::StringView | name | ) |

Erases and frees a complex effect.

Parameters

  name | The name of the complex effect to erase.

## ◆ relinquish()

nkMemory::UniquePtr<ComplexEffect> nkAstraeus::ComplexEffectManager::relinquish | ( | nkMemory::StringView | name | ) |

Requests the manager to relinquish the ownership of a resource and pass it around.

Parameters

  name | The name of the recorded resource to relinquish.

Returns
  The ownership over the resource requested if available, nullptr otherwise.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsAstraeus/Graphics/ComplexEffects/ComplexEffectManager.h